﻿using VisualWip.Core;
using VisualWip.Core.Columns;
using VisualWip.Core.Interfaces;
using VisualWip.PresentationModel.SettingsViewModels;

namespace VisualWip.PresentationModel.WorkItem
{
    public class SingleWorkItemSettingsViewModel : WorkItemsSettingsViewModelBase<SingleWorkItemColumn>
    {
        public SingleWorkItemSettingsViewModel(Application application, SingleWorkItemColumn column, IWorkItemSizeProvider workItemSizeProvider,
                                                    IColumnTypeProvider columnTypeProvider)
            : base(application, column,workItemSizeProvider,columnTypeProvider)
        {
           column.WorkItemProvider.Init();
        }

        public override string SettingsWindowName
        {
            get { return "Single work item column settings"; }
        }

        public string WorkItemId
        {
            get { return Column.WorkItemId != null ? Column.WorkItemId : string.Empty; }
            set
            {
                if (value != Column.WorkItemId && !string.IsNullOrWhiteSpace(value))
                {
                    Column.WorkItemId = value;
                    OnPropertyChanged(this, () => WorkItemId);
                }
            }
        }
    }
}